package project.controller;
import javax.servlet.http.HttpServlet;
import org.json.JSONObject;
import project.dao.ProjectDao;
import project.entity.Project;

import user.entity.User;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class toUpdateProjectServlet extends HttpServlet{
    private final ProjectDao projectDao = new ProjectDao();
    private static final long serialVersionUID = 1;

    public toUpdateProjectServlet() {
        super();
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws IOException, ServletException {
        doPost(request, response);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws IOException, ServletException {
        System.out.println("进入了toUpdateProjectServlet");
        Project project = projectDao.findProjectById(Integer.parseInt(request.getParameter("id")));
        System.out.println(project);
        request.setAttribute("project",project);
        request.getRequestDispatcher("/view/project/project-update.jsp").forward(request,response);
    }
}
